package formulation;

import java.util.List;

import es.deusto.ingenieria.is.csp.formulation.Constraint;
import es.deusto.ingenieria.is.csp.formulation.Variable;

public class LeadDigitConstraint extends Constraint<Integer> {

	public LeadDigitConstraint(String name, List<Variable<Integer>> variables) {
		super(name, variables);
	}

	@Override
	public boolean isSatisfied(Variable<Integer> var, Integer valueToAssign) {
		return (valueToAssign != 0);
	}

	@Override
	public String toString() {
		String string = "";
		for (Variable<Integer> var : getVariables()) {
			string += var.getName() + ", ";
		}
		string = (String) string.subSequence(0, (string.length()) - 2);
		return getName() + " (" + string + ")";
	}
}
